<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/sql/models/qsqlrelationaltablemodel.cpp -->
<head>
  <title>Qt 4.3: QSqlRelation Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QSqlRelation Class Reference<br /><sup><sup>[<a href="qtsql.html">QtSql</a> module]</sup></sup></h1>
<p>The QSqlRelation class stores information about an SQL foreign key. <a href="#details">More...</a></p>
<pre> #include &lt;QSqlRelation&gt;</pre><ul>
<li><a href="qsqlrelation-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qsqlrelation.html#QSqlRelation">QSqlRelation</a></b> ()</li>
<li><div class="fn"/><b><a href="qsqlrelation.html#QSqlRelation-2">QSqlRelation</a></b> ( const QString &amp; <i>tableName</i>, const QString &amp; <i>indexColumn</i>, const QString &amp; <i>displayColumn</i> )</li>
<li><div class="fn"/>QString <b><a href="qsqlrelation.html#displayColumn">displayColumn</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qsqlrelation.html#indexColumn">indexColumn</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qsqlrelation.html#isValid">isValid</a></b> () const</li>
<li><div class="fn"/>QString <b><a href="qsqlrelation.html#tableName">tableName</a></b> () const</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QSqlRelation class stores information about an SQL foreign key.</p>
<p>QSqlRelation is a helper class for <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>. See <a href="qsqlrelationaltablemodel.html#setRelation">QSqlRelationalTableModel::setRelation</a>() and <a href="qsqlrelationaltablemodel.html#relation">QSqlRelationalTableModel::relation</a>() for details.</p>
<p>See also <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>, <a href="qsqlrelationaldelegate.html">QSqlRelationalDelegate</a>, and <a href="sql-relationaltablemodel.html">Relational Table Model Example</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QSqlRelation"></a>QSqlRelation::QSqlRelation ()</h3>
<p>Constructs an invalid <a href="qsqlrelation.html">QSqlRelation</a> object.</p>
<p>For such an object, the <a href="qsqlrelation.html#tableName">tableName</a>(), <a href="qsqlrelation.html#indexColumn">indexColumn</a>(), and <a href="qsqlrelation.html#displayColumn">displayColumn</a>() functions return an empty string.</p>
<p>See also <a href="qsqlrelation.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QSqlRelation-2"></a>QSqlRelation::QSqlRelation ( const <a href="qstring.html">QString</a> &amp; <i>tableName</i>, const <a href="qstring.html">QString</a> &amp; <i>indexColumn</i>, const <a href="qstring.html">QString</a> &amp; <i>displayColumn</i> )</h3>
<p>Constructs a <a href="qsqlrelation.html">QSqlRelation</a> object, where <i>tableName</i> is the SQL table name to which a foreign key refers, <i>indexColumn</i> is the foreign key, and <i>displayColumn</i> is the field that should be presented to the user.</p>
<p>See also <a href="qsqlrelation.html#tableName">tableName</a>(), <a href="qsqlrelation.html#indexColumn">indexColumn</a>(), and <a href="qsqlrelation.html#displayColumn">displayColumn</a>().</p>
<h3 class="fn"><a name="displayColumn"></a><a href="qstring.html">QString</a> QSqlRelation::displayColumn () const</h3>
<p>Returns the column from table <a href="qsqlrelation.html#tableName">tableName</a>() that should be presented to the user instead of a foreign key.</p>
<h3 class="fn"><a name="indexColumn"></a><a href="qstring.html">QString</a> QSqlRelation::indexColumn () const</h3>
<p>Returns the index column from table <a href="qsqlrelation.html#tableName">tableName</a>() to which a foreign key refers.</p>
<h3 class="fn"><a name="isValid"></a>bool QSqlRelation::isValid () const</h3>
<p>Returns true if the <a href="qsqlrelation.html">QSqlRelation</a> object is valid; otherwise returns false.</p>
<h3 class="fn"><a name="tableName"></a><a href="qstring.html">QString</a> QSqlRelation::tableName () const</h3>
<p>Returns the name of the table to which a foreign key refers.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
